<template>
	<div>
		<!-- 标题部分 -->
		<div class="ques-opt-title">
			<i v-if="question?.attribute?.required" class="star"></i>
			{{ index + 1 }}、{{ question.title }}
			<i v-if="!isValid" class="required-err-msg">必填</i>
		</div>
		<!-- 输入框部分 -->
		<div class="ques-opt-body">
			<div v-for="i in question.children" :key="i.id" class="ques-opt-item">
				<input v-if="isDate(i)" type="date" v-model="question.answer[i.id]" />
				<input v-else type="text" v-model="question.answer[i.id]" />
			</div>
		</div>
	</div>
</template>

<script>
import ques from "./quesComponents.js";
export default {
	mixins: [ques],
	methods: {
		isDate(i) {
			return i?.attribute?.dataType === "date";
		},
		isFinished() {
			return (
				this.question?.answer &&
				Object.values(this.question.answer).every((e) => {
					return e;
				})
			);
		}
	}
};
</script>
